export const showModel = (params) => {
  return new Promise((resolve, reject) => {
    wx.hideToast();
    wx.showModal({
      ...params,
      success: (res) => {
        resolve(res)
      },
      fail: (err) => {
        reject(err)
      }
    })
  })
}

export const showToast = (params) => {
  return new Promise((resolve, reject) => {
    wx.showToast({
      icon: 'none',
      ...params,
      success: (res) => {
        resolve(res)
      },
      fail: (err) => {
        reject(err)
      }
    })
  })
}

export const login = () => {
  return new Promise((resolve, reject) => {
    wx.login({
      timeout: 10000,
      success: (res) => {
        resolve(res)
      },
      fail: (err) => {
        reject(err)
      }
    })
  })
}